package models

import (
	"time"
	"github.com/jinzhu/gorm"
)

type ArticleLabel struct {
	ID       int       `gorm:"primary_key" json:"id"`
	Name     string    `json:"name"`
	Sort     int       `json:"sort"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func (u ArticleLabel) TableName() string {
	return "article_label"
}
func GetArticleLabels() ([]*ArticleLabel, error) {
	var articleLabels []*ArticleLabel
	err := DB.Where("is_enabled=?",0).Find(&articleLabels).Error

	if err != nil && err != gorm.ErrRecordNotFound {
		return nil, err
	}

	return articleLabels, nil
}
